#ifndef __controller_h_
#define __controller_h_
#include "adevs/adevs.h"
#include "io_type.h"

class Controller: public adevs::Atomic<IO_Type> 
{
	public:
		/// Model input port.
		const int in_far_sensor(int side) { return side; }; // 0 .. 3 vstupy prijezdu jednotlivych stran
		const int in_near_sensor(int side) { return side + sides_count; }; // 4 .. 7 vstupy prijezdu jednotlivych stran
		/// Model output port.
		const int out_semaphor_cmd(int side) { return side + sides_count*2; }; // 8..11 vystupy pro jednotlive strany

		const int get_sides_count() { return sides_count; }
		const bool is_far_sensor(int port) { return port < sides_count; }
		const bool is_near_sensor(int port) { return port >= sides_count; }
		const int get_side_from_input(int port) { return port % sides_count; }

	private:
		static const int sides_count = 4;
};

#endif
